<?php

use Illuminate\Http\Request;
use Illuminate\Routing\Router;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::group(['prefix'=>'v1'],function (Router $router){
    $router->get('login','Api\UserController@login');
    $router->post('register','Api\UserController@register');

    $router->get('brew-methods','Api\BrewMethodsController@index');

    $router->get('/cafes','Api\CafeController@index');
    $router->get('/cafes/{cafe}','Api\CafeController@show');

    $router->get('/tags','Api\TagController@index');

    $router->get('cities','Api\CityController@index');
    $router->get('cities/{slug}','Api\CityController@getBySlug');


    $router->group(['middleware'=>['jwt.api']],function (Router $router){
        $router->get('my','Api\UserController@my');
        $router->put('user','Api\UserController@profile');
        $router->get('logout','Api\UserController@logout');

        $router->post('/cafes','Api\CafeController@store');
        $router->post('/cafes/{cafe}/like','Api\CafeController@like');
        $router->delete('/cafes/{cafe}/like','Api\CafeController@delLike');
        $router->post('/cafes/{cafe}/tags','Api\CafeController@addTags');
        $router->delete('/cafes/{cafe}/tag/{tag}','Api\CafeController@delTag');

    });

});
